home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pyr_openingcutscene.cog < prev    next >
Text File  |  1999-11-15  |  11KB  |  426 lines

  1. # Jones 3D Cog Script
  2. #
  3. # pyr_openingcutscene.cog
  4. #
  5. # CutScene of Indy arriving at level start.
  6. #
  7. # [RKD] && [RT]
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ========================================================================================
  11. symbols
  12.  
  13. message    startup
  14. message    user0
  15. message    entered
  16.  
  17. #animations
  18. keyframe    tocrossarms=0in_stand1_bd_2.key        local
  19. keyframe    crossarms=0in_stand2.key               local
  20. keyframe    handsonhips=0in_stand4.key             local
  21. keyframe    tohandsonhips=0in_stand1_bd_4.key     local
  22. keyframe    getOut=ij_getup.key                    local
  23.  
  24. #template    actortpl=indy_sh_actor            local
  25. template    jeepActorTpl=jeep_actor_pyr    local
  26.  
  27. #jeep action surfaces
  28. surface    jeep2trigger            mask=0x004    #mask lets surface know to look for an actor
  29. surface    speed2        linkid=2    mask=0x004
  30. surface    speed1        linkid=1    mask=0x004
  31. surface    lastFace                mask=0x004
  32.  
  33. # jeep materials
  34. material    topMat=pyr_jeep_top.mat        local
  35. material    botMat=pyr_jeep_bbmp.mat    local
  36.  
  37. # adjoins to fiddle with
  38. surface    desertedge    nolink
  39.  
  40. # world items
  41. thing    sign        nolink
  42. thing    jeep        nolink
  43. thing    jeep2        nolink
  44. thing    fadeplate    nolink
  45. thing    player        local
  46. thing    finalJeep
  47. thing    scorpion    nolink
  48. #thing    sun            nolink
  49.  
  50. # world items to hide
  51. thing     block1        nolink
  52. thing    block2        nolink
  53. thing    block3        nolink
  54. thing    sign2         nolink
  55. thing    hyena1        nolink
  56. thing    hyena2        nolink
  57. thing    hyena3        nolink
  58. surface    mono4trigger    nolink
  59.  
  60. # various actor-y items
  61. thing    jeepActor    local
  62. thing    indyactor
  63.  
  64. # actor marks
  65. thing    signmark
  66. thing    meroemark
  67.  
  68. # actor lookthings
  69. thing    farlook
  70. thing    signindylook
  71.  
  72. # cameras
  73. thing    startcam
  74. thing    arrivecam
  75. thing    signcam
  76.  
  77. # camera lookthings
  78. thing    startcamlook
  79. thing    arrivecamlook
  80. thing    signcamlook
  81.  
  82. # saylines
  83. sound    meroe=pr01j01a.wav    local
  84. sound    mines=pr04j01.wav    local
  85. sound    wishful=pr04j02.wav    local
  86.  
  87. # non-sayline sounds
  88. sound    jeepstop=jep_engine_off.wav        local
  89. sound    passby=pyr_jeep_passby.wav        local
  90.  
  91. # music
  92. sound    intro=mus_pyr_intro.wav    local
  93.  
  94. # cogs
  95. cog        hidepitthings
  96.  
  97. # variables
  98. int        curchannel=0    local
  99. int        curtrack=0        local
  100. int        cursound=0        local
  101.  
  102. int        bSeen=0            local
  103. int        alldone=0        local
  104.  
  105. # subroutine
  106. flex    endscene=0.0    local
  107. end
  108.  
  109. # ========================================================================================
  110. code
  111.  
  112. # =======================================================================
  113. # LIST OF GLOBAL VARIABLES USED THROUGHOUT MEROE                        #
  114. #    1: (may be used by a random number generator)                        #
  115. #    2: 1 if Indy is in jeep, 0 if he isn't                                #
  116. #    3: Status of the Nubian Kid                                            #
  117. #            0 = not met                                                    #
  118. #            1 = met in cave, not at cliff                                #
  119. #            2 = met at cliff                                            #
  120. #            3 = got watch and gone                                        #
  121. #            4 = in mid-cutscene                                            #
  122. #    4: number of lightboxes raised                                        #
  123. #    5: number of light sentries (monojackals) raised                    #
  124. #    6: number of bars removed from the door                                #
  125. #    7: number of sign readings                                            #
  126. #    8: number of hyenas killed                                            #
  127. #    9: number of lightroom heiratics read                                #
  128. #    10:    (not used)                                                        #
  129. #    11:    1 if indy is in the interior, 0 if in the exterior dunes        #
  130. #    12: number of minedoor activations (info used by Solomon's mines)    #
  131. #    13:    (not used, bad luck)                                            #
  132. #    14:    (not used)                                                        #
  133. #    15: Hal's "random" sayline control                                        #
  134. # =======================================================================
  135.  
  136. startup:
  137.  
  138.     SetMasterCog(GetSelfCog()); # RT: Set master cog so we get autosave/restore message
  139.  
  140.     Sleep(0.001); # Let engine get set up
  141.  
  142.     # Start on black...
  143.     SetCameraLookInterp(2, 0);
  144.     SetCameraPosInterp(2, 0);
  145.     SetCameraFocus(2, startcam);
  146.     SetCameraSecondaryFocus(2, startcamlook);
  147.     SetCurrentCamera(2);
  148.  
  149.     return;
  150.  
  151. # ..............................................................................
  152.  
  153. user0: # RT: Indicates that autosave/restore has completed...
  154.  
  155.     if (bSeen) return; # RT
  156.     bSeen = 1;
  157.  
  158.     player = GetLocalPlayerThing();
  159.  
  160.     # set up initial camera and fade in
  161.     SetCameraLookInterp(2, 0);
  162.     SetCameraPosInterp(2, 0);
  163.     SetCameraFocus(2, startcam);
  164.     SetCameraSecondaryFocus(2, startcamlook);
  165.     SetCurrentCamera(2);
  166.  
  167.     # hide stuff, mainly to prevent immediate texture cache-in
  168.     SetThingFlags(block1, 0x10);
  169.     SetThingFlags(block2, 0x10);
  170.     SetThingFlags(block3, 0x10);
  171.     SetThingFlags(sign, 0x10);
  172.     SetThingFlags(sign2, 0x10);
  173.     SetThingFlags(hyena1, 0x10);
  174.     SetThingFlags(hyena2, 0x10);
  175.     SetThingFlags(hyena3, 0x10);
  176.  
  177.     # hide monojackal 4 and parts under no-see
  178.     ClearAdjoinFlags(mono4trigger, 0x1);
  179.     SetFaceGeoMode(mono4trigger, 4);
  180.  
  181.     SetActorFlags(player, 0x200000);
  182.     SendMessage(hidepitthings, user2);
  183.     AISetCutsceneMode(scorpion);
  184.     SetAdjoinFlags(desertedge, 0x1);    
  185.     StartCutscene(2);
  186.  
  187.     AISetMoveSpeed(scorpion, .5);
  188.     AISetMoveFrame(scorpion, 1);
  189.     
  190.     CopyPlayerHolsters(player, jeep);
  191.     SetThingThrust(jeep, '0.0 3.0 0.0');
  192.     
  193.     # make sure jeep has gas can
  194.     SendMessageEx(GetThingClassCog(jeep), user1, jeep, 0, 0, 0);
  195.     
  196.     sleep(.5);
  197.     ThingFadeAnim(fadeplate, 1.0, 0.0, 2.0, 0);    
  198.     PlaySoundLocal(passby, 1, 0, 0, 0);
  199.     Sleep(2.2);
  200.     SetThingFlags(fadeplate, 0x10);
  201.     
  202.     # sleep for 0.01 to generate a frame
  203.     Sleep(0.01);
  204.     
  205.     # now proceed to other stuff...    
  206.     SetThingFlags(player, 0x80000);    
  207.     SetThingFlags(jeep2, 0x80000);
  208.     SetThingFlags(finalJeep, 0x80000);
  209.  
  210.     # RT: Set up jeep materials
  211.     SetMaterialCel(topMat, 1);
  212.     SetMaterialCel(botMat, 1);
  213.     
  214.     # get things moving
  215.     PlaySoundLocal(intro, 1, 0, 0, 0);
  216.     Sleep(1);
  217.     MoveToFrame(startcam, 1, 3);
  218.     MoveToFrame(startcamlook, 1, 2.2);
  219.     sleep(.5);
  220.     MoveToFrame(startcam, 1, 2);
  221.     sleep(.4);
  222.     
  223.     # turn shadow off on jeep
  224.     ClearThingFlags(jeep, 0x4000);
  225.     
  226.     WaitForStop(startcam);
  227.     MoveToFrame(startcamlook, 2, 2);
  228.  
  229.     return;
  230.  
  231. # .................................................................................
  232. entered:
  233. # ---> 2nd jeep face, last jeep face, slowdown1, slowdown2
  234.  
  235.     if (GetSourceRef() == scorpion) return;
  236.     
  237.     # further insurance against the repeating cutscene bug
  238.     if (alldone) return;
  239.  
  240.     if ((GetSourceRef() != jeep) && (GetSourceRef() != jeep2)) return;
  241.     
  242.     if (GetSenderRef() == speed1)
  243.     {
  244.         SetThingThrust(jeep2, '0 1 0');
  245.     }
  246.     
  247.     if (GetSenderID() == 2)
  248.     {
  249.         SetThingThrust(jeep2, '0 2 0');
  250.     }
  251.     
  252.     if (GetSenderRef() == speed2)
  253.     {
  254.         # make blocks visible when closer
  255.         ClearThingFlags(block1, 0x10);
  256.         ClearThingFlags(block2, 0x10);
  257.         ClearThingFlags(block3, 0x10);
  258.         ClearThingFlags(sign, 0x10);
  259.         ClearThingFlags(sign2, 0x10);
  260.         
  261.         # jump to camera near blocks
  262.         SetCameraFocus(2, arrivecam);
  263.         SetCameraSecondaryFocus(2, jeep2);
  264.     
  265.         # turn off adjoin to entry sectors
  266.         ClearAdjoinFlags(desertedge, 0x1);    
  267.     }
  268.     
  269.     if (GetSenderRef() == jeep2trigger)
  270.     {
  271.         # let the jeep get over the cliff
  272.         sleep(1);
  273.  
  274.         #stop the 1st jeep
  275.         StopThing(jeep);
  276.         SetThingFlags(jeep, 0x80000);
  277.         sleep(.5);
  278.         
  279.         #initiate the 2nd jeep
  280.         ClearThingFlags(jeep2, 0x80000);
  281.         CopyPlayerHolsters(player, jeep2);
  282.         
  283.         # make sure new jeep has gas can
  284.         SendMessageEx(GetThingClassCog(jeep2), user1, jeep2, 0, 0, 0);
  285.         
  286.         SetThingThrust(jeep2, '0 3 0');
  287.         DestroyThing(jeep);
  288.     }
  289.     else if (GetSenderRef() == lastface)
  290.     {
  291.         # reveal the roaming hyenas
  292.         ClearThingFlags(hyena1, 0x10);
  293.         ClearThingFlags(hyena2, 0x10);
  294.         ClearThingFlags(hyena3, 0x10);
  295.         
  296.         # stop the 2nd jeep
  297.         StopThing(jeep2);
  298.         CopyOrientAndPos(jeep2, arrivecamlook);
  299.         Sleep(.25);
  300.         
  301.         # create another jeep at the right spot
  302.         jeepActor = CreateThing(jeepActortpl, jeep2);
  303.         SetCameraSecondaryFocus(2, jeepActor);
  304.  
  305.         # copy info over, add gas can, and destroy old jeep
  306.         CopyPlayerHolsters(player, jeepActor);
  307.         CopyOrientandPos(Jeep2, jeepActor);
  308.         PlaySoundThing(jeepstop, jeep2, 1, -1, -1, 0);
  309.         DestroyThing(jeep2);
  310.         
  311.         # indy gets out of jeep
  312.         ClearThingFlags(jeepActor, 0x80000);
  313.         SendMessageEx(GetThingClassCog(jeepActor), user1, jeep, 0, 0, 0);
  314.         PlayKey(jeepActor, getOut, 4, 0x12, 1);
  315.  
  316.         # switch between actor jeep and driveable jeep + indyactor
  317.         CopyOrientAndPos(jeepActor, finalJeep);
  318.         SetThingFlags(jeepActor, 0x80000);
  319.         ClearThingFlags(finalJeep, 0x80000);
  320.         CopyPlayerHolsters(player, indyActor);
  321.         ClearThingFlags(indyActor, 0x80000);
  322.  
  323.         # change camera
  324.         SetCameraSecondaryFocus(2, arrivecamlook);
  325.         
  326.         # indy turns to face the level
  327.         AISetMoveSpeed(indyactor, 1.0);
  328.         SetThingMaxRotVel(indyactor, 180);
  329.         AISetLookThingEyeLevel(indyActor, farlook);
  330.         AIWaitForStop(indyactor);
  331.  
  332.         #indy starts talking
  333.         curchannel = PlayVoice(indyactor, meroe, 1, 0);
  334.         sleep(2);
  335.         
  336.         # indy walks a bit, camera follows
  337.         AISetLookThingEyeLevel(indyactor, meroemark);
  338.         AIWaitForStop(indyactor);
  339.         AISetMoveThing(indyactor, meroemark, 0);
  340.         MoveToFrame(arrivecam, 1, .5);
  341.         MoveThingToPos(arrivecamlook, GetThingPos(meroemark), 2);
  342.         AIWaitForStop(indyactor);
  343.         AISetLookThing(indyactor, farlook);
  344.         AIWaitForStop(indyactor);
  345.         AttachThingToThing(signcamlook, indyactor);
  346.  
  347.         # a few histrionics
  348.         curtrack = PlayKey(indyactor, tohandsonhips, 4, 0x12, 1);
  349.         curtrack = PlayKey(indyactor, handsonhips, 4, 0x14, 0);
  350.         WaitForSound(curchannel);
  351.         StopKey(indyactor, curtrack, 0.25);
  352.  
  353.         Sleep(.75);
  354.         
  355.         #indy walks to the sign
  356.         AISetLookThing(indyactor, sign);
  357.         AIWaitForStop(indyactor);
  358.         AISetMoveSpeed(indyactor, 1);
  359.         AISetMoveThing(indyactor, signmark, 0);
  360.         curchannel = PlayVoice(indyactor, mines, 1, 0);
  361.         
  362.         sleep(.75);
  363.         SetCameraLookInterp(2, 0);
  364.         SetCameraFocus(2, signcam);
  365.         SetCameraSecondaryFocus(2, signcamlook);
  366.         
  367.         AIWaitForStop(indyactor);
  368.         AISetLookThing(indyactor, signindylook);
  369.  
  370.         #line ends, indy crosses his arms and gets doubtful
  371.         WaitForSound(curchannel);
  372.         curtrack = PlayKey(indyactor, tocrossarms, 4, 0x12, 1);
  373.         curtrack = PlayKey(indyactor, crossarms, 4, 0x14, 0);
  374.         curchannel = PlayVoice(indyactor, wishful, 1, 1);
  375.         
  376.         StopKey(indyactor, curtrack, 0.25);
  377.         AISetLookThing(indyActor, startcamlook);
  378.         AIWaitForStop(indyactor);
  379. //        AISetLookThing(indyActor, farlook);
  380. //        AIWaitForStop(indyactor);
  381.  
  382.         sleep(.5);
  383.  
  384.         call endscene;
  385.     }
  386.  
  387.     return;
  388.  
  389. endscene:
  390.     # replace player, etc.
  391.     CopyOrientAndPos(indyactor, player);
  392.     SetThingFlags(indyactor, 0x80000);
  393.     ClearThingFlags(player, 0x80000);
  394.     ClearActorFlags(player, 0x200000);
  395.     SetCameraPosition(1, GetThingPos(signcam));
  396.     SetCurrentCamera(1);
  397.  
  398.     # set monojackal4 stuff to normal
  399.     SetAdjoinFlags(mono4trigger, 0x1);
  400.     SetFaceGeoMode(mono4trigger, 0);
  401.  
  402.     # clean up a few things
  403.     DestroyThing(fadeplate);
  404.     DestroyThing(jeepActor);
  405.     DestroyThing(indyactor);
  406.     DestroyThing(signmark);
  407.     DestroyThing(meroemark);
  408.     DestroyThing(farlook);
  409.     DestroyThing(signindylook);
  410.     DestroyThing(startcam);
  411.     DestroyThing(arrivecam);
  412.     DestroyThing(signcam);
  413.     DestroyThing(startcamlook);
  414.     DestroyThing(arrivecamlook);
  415.     DestroyThing(signcamlook);
  416.     
  417.     EndCutscene();
  418.  
  419.     sleep(1);
  420.  
  421.     alldone = 1;
  422.     return;
  423.     
  424. end
  425.  
  426.